package validation;

import dbmanager.DBManager;

public class Minlength implements Validation 
{
	DBManager db;
	String ConditionValue;
	
	
	public void setDbmanager(DBManager db)
	{
		this.db=db;
	}
	
	public String getMessage()
	{
		return "Minimum length of the value must be "+ConditionValue;
	}

	public boolean validate(String Value) 
	{
		return false;
	}

	public boolean validate(String actualvalue, String validationvalue)
	{
		try 
		{
			int minlength = Integer.parseInt(validationvalue);
			if(minlength>(actualvalue.length()))
				return true;
		}
		catch (Exception e) 
		{
			e.printStackTrace();
			return false;
		}
		return false;
	}

	public boolean validate(String Value, String ConditionValue, String Refvalue) 
	{
		this.ConditionValue = ConditionValue;
		return validate(Value, ConditionValue);
	}

	public void setBasicvalue(String value) 
	{
	}
	public static void main(String[] args) 
	{
		Minlength fix = new Minlength();
		System.out.println("Result "+fix.validate("asd", "3"));
		
	}
}
